{include="header"}
{include="navigator"}

<div id = "container">
	<h1 class = "header">เพิ่มข้อมูลพื้นฐาน</h1>

	<form action = '{$action}' method = 'post' enctype='multipart/form-data' id = "common-form">
		<input type = "hidden" name = "id" value = "{$id}">
		<ul class = 'form'>
			<li class = 'node'>
				<label for='name' class = 'label'>ชื่อข้อมูลพื้นฐาน : </label>
				<input type = 'text' id = 'name' class = 'input validate[required] text-input w600' name = 'name' value = "{$data['name']}">
				<span class='require'>*</span>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='target' class = 'label'>จำนวน : </label>
				<input type = 'text' id = 'target' class = 'input validate[required] text-input w50' name = 'target' value = "{$data['target']}">
				<span class='require'>*</span>
			</li>
			<li class = 'node'>
				<label for='group' class = 'label'>องค์ประกอบที่ : </label>
				<select name = 'group'>
				{loop="group"}
					{if="$value.id==$data['gid']"}
						<option value = '{$value.id}' selected>{$value.name}</option>
					{else}
						<option value = '{$value.id}'>{$value.name}</option>
					{/if}
				{/loop}
				</select>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='upload' class = 'label'>แนบไฟล์ : </label>
				<input type = "file" name = "upload" id = "upload">
				<span class = 'desc'></span>
				<br>
				{if="$data['upload'] != ''"}
					<a href = "{$data['upload']}" target = "_blank"><img src="images/filetype_icons/{$data['icon']}"></a>
					<a href = "common-delete-file.php?id={$data['id']}">ลบไฟล์</span>
				{/if}
			</li>
			<li>
				<input type = 'submit' value = ' ตกลง ' class = 'submit'>
				<input type = 'button' value = ' ยกเลิก ' class = 'submit' onclick = "location.href='common.php'">
			</li>
		</ul>
	</form>
</div>

{include="footer"}